package com.xx.controller;

import com.xx.config.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("hello")
public class HelloController {
    @Value("${color}")
    private String color;
    @Value("${user.uname}")
    private String userName;
    @Value("${user.sex}")
    private String sex;
    @Value("${user.age}")
    private int age;

    @Autowired
    User user;
    @GetMapping("/say")
    public String sayHello(){
        System.out.println(userName+"----"+sex+"-----"+age);
        return "hello SpringBoot"+"-------"+color;
    }

    @GetMapping("/say1")
    public String say(){
        System.out.println(user.toString());
        return "hello SpringBoot1";
    }
}
